/**
 * @param { string } path
 * @returns { Boolean }
 */
 export function isExternal (path) {
    return /^(https?:|mailto:|tel:)/.test(path)
}

// 获取屏幕缩放比例
export function getRatio() {
    let ratio = 0, screen = window.screen
    let ua = navigator.userAgent.toLocaleLowerCase()

    if (window.devicePixelRatio !== undefined) {
        ratio = window.devicePixelRatio
    } else if (~ua.indexOf("msie")) {
        if (screen.deviceXDPI && screen.logicalXDPI) {
            ratio = screen.deviceXDPI / screen.logicalXDPI
        }
    } else if (window.outerWidth !== undefined && window.innerWidth !== undefined) {
        ratio = window.outerWidth / window.innerWidth
    }

    if (ratio) {
        ratio = Math.round(ratio * 100)
    }

    return ratio
}